package cn.dakaqi.dao;

import java.util.List;

import cn.dakaqi.entities.AreaCity;
import cn.dakaqi.entities.AreaDistrict;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import cn.dakaqi.entities.AreaProvince;

/**
 * Created by chunyang on 2016/12/6.
 */
public interface ProvinceDao extends PagingAndSortingRepository<AreaProvince, Long>, JpaSpecificationExecutor<AreaProvince>
{
    //	@Modifying
    //	@Query("delete from Activity activity where activity.user.id=?1")
    //	void deleteByUserId(Long id);

    @Query(nativeQuery = true, value = "select ID,CODE,NAME  from U_AREA_PROVINCE")
    List<AreaProvince> queryAllProvince();

    @Query(nativeQuery = true, value = "select ID,CODE,NAME,FATHER from U_AREA_CITY ")
    public List<AreaCity> queryAllCity();

    @Query(nativeQuery = true, value = "select ID,CODE,NAME,FATHER from U_AREA_DISTRICT ")
    public List<AreaDistrict> queryAllDistrict();

}
